import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Markdown from 'vite-plugin-vue-markdown'
// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue({
            include: [/\.vue$/, /\.md$/], // <--
        }),
        Markdown(),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url)),
        },
    },
    css: {
        preprocessorOptions: {
            // scss:{
            //   additionalData:'@import "/src/assets/style/theme.scss";'
            // }
            scss: {
                additionalData: '@import "/src/assets/styles/common.scss";',
            },
        },
    },
    base: '/',
    build: {
        minify: 'terser', // 必须启用：terserOptions配置才会有效
        terserOptions: {
            compress: {
                // 生产环境时移除console.log调试代码
                drop_console: true,
                drop_debugger: true,
            },
        },
    },
})
